{% extends 'base.html' %}
{% block title %}Welcome{% endblock %}

{% block extra-head %}
<link rel="stylesheet" type="text/css"  media="screen" href="{{ MEDIA_URL }}user.css" />
{% endblock %}

{% block content %}

{% ifequal user profile_user %}
<a style="float:right" href="{% url edit_user id=profile_user.id %}">Edit profile</a>
{% endifequal %}
<h2>{{ profile_user.display_name }}</h2>

{{ profile_user.display_name }} is in 
{% for c in profile_user.current_constituencies.all %}
{% if forloop.last and not forloop.first %}and {% endif %}
<a href="{% url constituency c.slug %}">{{ c.name }}</a>{% if not forloop.last %}, 
{% endif %}
{% endfor %}

<h3>Recent activity</h3>
{% if activity %}
  <ul>
  {% for item in activity %}
    <li><a href='{{ item.task.get_absolute_url }}'>{{ item.task }}</a>, {{ item.state_string }} <span class="quiet" style="font-size:0.7em">{{ item.date_modified.date }}</span></li>
  {% endfor %}
  </ul>
{% else %}
  {{ profile_user.display_name }} hasn't done anything recently.
{% endif %}

{% if form %}
<form action="" method="post">
{{ form.as_p }}
<input type="submit" />
</form>
{% endif %}

<h3>Badges</h3>
<ul class="badges">
{% for badge in badges %}
  <li class="badge"><a href='{% url task slug=badge.task.slug %}'>{{ badge.name }}</a><br/><small>{{ badge.date_awarded.date }}</small></li>
{% endfor %}
</ul>

{% endblock %}
